package com.pingao.mp.modular.fls.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 * 活动
 * </p>
 *
 * @author 闻品高
 * @since 2020-01-15
 */
@TableName("fls_activity")
@Data
public class Activity extends Model<Activity> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 名称
     */
    private String name;

    /**
     * 内容
     */
    private String content;

    /**
     * 规则
     */
    private String rule;

    /**
     * 注意事项
     */
    private String precautions;

    /**
     * 开始时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startingTime;

    /**
     * 结束时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建人
     */
    private Integer userId;
    /**
     * 添加时间
     */
    private LocalDateTime addTime;

    /**
     * 状态（0：禁用、1：启用）
     */
    private Integer status;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }


    /**
     * 创建人名称
     */
    @TableField(exist = false)
    private String userName;
    /**
     * 状态名称
     */
    @TableField(exist = false)
    private String statusName;

    /**
     * 奖项
     */
    @TableField(exist = false)
    private String awards;

    //字段名称 仅供mybatis plus（条件构造）使用
    public static final String COL_ID = "id";
    public static final String COL_NAME = "name";
    public static final String COL_CONTENT = "content";
    public static final String COL_RULE = "rule";
    public static final String COL_PRECAUTIONS = "precautions";
    public static final String COL_STARTING_TIME = "starting_time";
    public static final String COL_END_TIME = "end_time";
    public static final String COL_REMARK = "remark";
    public static final String COL_USER_ID = "user_id";
    public static final String COL_ADD_TIME = "add_time";
    public static final String COL_STATUS = "status";
}
